package com.turing.post.account.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.turing.post.util.PCPSUtil;

/**
 * 帐户子系统交易附加流水
 * 
 * @author ZXL
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "AccountSystemAddTradDetail")
@IdClass(AccountSystemAddTradDetail.class)
public class AccountSystemAddTradDetail implements Serializable {

	public AccountSystemAddTradDetail() {
		super();
	}

	/**
	 * 帐户子系统流水号
	 */
	private String accSeqNo = null;

	@Id
	@Column(name = "AccSeqNo", nullable = false)
	public String getAccSeqNo() {
		return this.accSeqNo;
	}

	public void setAccSeqNo(String accSeqNo) {
		this.accSeqNo = accSeqNo;
	}

	/**
	 *记帐子序号
	 */
	private Integer accSubSeqNo = null;

	@Id
	@Column(name = "AccSubSeqNo", nullable = false)
	public Integer getAccSubSeqNo() {
		return this.accSubSeqNo;
	}

	public void setAccSubSeqNo(Integer accSubSeqNo) {
		this.accSubSeqNo = accSubSeqNo;
	}

	/**
	 * 发卡商NO
	 */
	private String issueCompanyNo = null;

	@Column(name = "IssueCompanyNo", nullable = false)
	public String getIssueCompanyNo() {
		return this.issueCompanyNo;
	}

	public void setIssueCompanyNo(String issueCompanyNo) {
		this.issueCompanyNo = issueCompanyNo;
	}

	/**
	 * 帐务日期
	 */
	private Date tranDate = null;

	@Column(name = "TranDate", nullable = false)
	public Date getTranDate() {
		return this.tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	/**
	 * 记帐时间
	 */
	private Date tranTime = null;

	@Column(name = "TranTime", nullable = false)
	public Date getTranTime() {
		return this.tranTime;
	}

	public void setTranTime(Date tranTime) {
		this.tranTime = tranTime;
	}

	/**
	 * 主帐号
	 */
	private BigInteger masterAccNo = null;

	@Column(name = "MasterAccNo", nullable = false)
	public BigInteger getMasterAccNo() {
		return this.masterAccNo;
	}

	public void setMasterAccNo(BigInteger masterAccNo) {
		this.masterAccNo = masterAccNo;
	}

	/**
	 * 卡号
	 */
	private String cardNo = null;

	@Column(name = "CardNo", nullable = true)
	public String getCardNo() {
		return this.cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	/**
	 * 卡种类ID
	 */
	private BigInteger cardClassicId = null;

	@Column(name = "CardClassicId", nullable = true)
	public BigInteger getCardClassicId() {
		return this.cardClassicId;
	}

	public void setCardClassicId(BigInteger cardClassicId) {
		this.cardClassicId = cardClassicId;
	}

	/**
	 * 子帐号
	 */
	private BigInteger subAccNo = null;

	@Column(name = "SubAccNo", nullable = false)
	public BigInteger getSubAccNo() {
		return this.subAccNo;
	}

	public void setSubAccNo(BigInteger subAccNo) {
		this.subAccNo = subAccNo;
	}

	/**
	 * 开户机构号
	 */
	private String openBranchNo = null;

	@Column(name = "OpenBranchNo", nullable = true)
	public String getOpenBranchNo() {
		return this.openBranchNo;
	}

	public void setOpenBranchNo(String openBranchNo) {
		this.openBranchNo = openBranchNo;
	}

	/**
	 * 开户
	 */
	public final static String TRANTYPE_OPEN = "00";

	/**
	 * 开户撤销
	 */
	public final static String TRANTYPE_OPEN_CANCELED = "10";

	/**
	 * 消费
	 */
	public final static String TRANTYPE_CONSUME = "01";

	/**
	 * 消费撤销
	 */
	public final static String TRANTYPE_CONSUME_CANCELED = "11";

	/**
	 * 充值
	 */
	public final static String TRANTYPE_DEPOSIT = "02";

	/**
	 * 充值撤销
	 */
	public final static String TRANTYPE_DEPOSIT_CANCELED = "12";

	/**
	 * 赎回
	 */
	public final static String TRANTYPE_REDEMP = "03";

	/**
	 * 赎回撤销
	 */
	public final static String TRANTYPE_REDEMP_CANCELED = "13";

	/**
	 * 扣手续费
	 */
	public final static String TRANTYPE_FEE = "04";

	/**
	 * 扣手续费撤销
	 */
	public final static String RANTYPE_FEE_CANCELED = "14";

	/**
	 * 调帐
	 */
	public final static String TRANTYPE_ADJUST = "99";

	/**
	 * 交易类型
	 */
	private String tranType = null;

	@Column(name = "TranType", nullable = false)
	public String getTranType() {
		return this.tranType;
	}

	public void setTranType(String tranType) {
		this.tranType = tranType;
	}

	/**
	 * 贷方发生额
	 */
	private BigInteger creditAmount = null;

	@Column(name = "CreditAmount", nullable = false)
	public BigInteger getCreditAmount() {
		return this.creditAmount;
	}

	public void setCreditAmount(BigInteger creditAmount) {
		this.creditAmount = creditAmount;
	}

	/**
	 * 借方发生额
	 */
	private BigInteger debitAmount = null;

	@Column(name = "DebitAmount", nullable = false)
	public BigInteger getDebitAmount() {
		return this.debitAmount;
	}

	public void setDebitAmount(BigInteger debitAmount) {
		this.debitAmount = debitAmount;
	}

	/**
	 * 交易后子帐户余额
	 */
	private BigInteger balance = null;

	@Column(name = "Balance", nullable = false)
	public BigInteger getBalance() {
		return this.balance;
	}

	public void setBalance(BigInteger balance) {
		this.balance = balance;
	}

	/**
	 * 交易后主帐户余额
	 */
	private BigInteger masBalance = null;

	@Column(name = "MasBalance", nullable = false)
	public BigInteger getMasBalance() {
		return this.masBalance;
	}

	public void setMasBalance(BigInteger masBalance) {
		this.masBalance = masBalance;
	}

	/**
	 * 交易摘要
	 */
	private String remark = null;

	@Column(name = "remark", nullable = false)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * 本日销售
	 */
	private BigInteger saleAmount = BigInteger.ZERO;

	@Transient
	public BigInteger getSaleAmount() {
		return this.saleAmount;
	}

	public void setSaleAmount(BigInteger saleAmount) {
		this.saleAmount = saleAmount;
	}

	/**
	 * 本日充值
	 */
	private BigInteger depositAmount = BigInteger.ZERO;

	@Transient
	public BigInteger getDepositAmount() {
		return this.depositAmount;
	}

	public void setDepositAmount(BigInteger depositAmount) {
		this.depositAmount = depositAmount;
	}

	/**
	 * 本日消费
	 */
	private BigInteger consumeAmount = BigInteger.ZERO;

	@Transient
	public BigInteger getConsumeAmount() {
		return this.consumeAmount;
	}

	public void setConsumeAmount(BigInteger consumeAmount) {
		this.consumeAmount = consumeAmount;
	}

	/**
	 * 本日赎回
	 */
	private BigInteger redemingAmount = BigInteger.ZERO;

	@Transient
	public BigInteger getRedemingAmount() {
		return this.redemingAmount;
	}

	public void setRedemingAmount(BigInteger redemingAmount) {
		this.redemingAmount = redemingAmount;
	}

	/**
	 * 本日扣手续费
	 */
	private BigInteger feeAmount = BigInteger.ZERO;

	@Transient
	public BigInteger getFeeAmount() {
		return this.feeAmount;
	}

	public void setFeeAmount(BigInteger feeAmount) {
		this.feeAmount = feeAmount;
	}

	/**
	 * 本日调整
	 */
	private BigInteger adjustAmount = BigInteger.ZERO;

	@Transient
	public BigInteger getAdjustAmount() {
		return this.adjustAmount;
	}

	public void setAdjustAmount(BigInteger adjustAmount) {
		this.adjustAmount = adjustAmount;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;

		result = prime
				* result
				+ ((this.getAccSeqNo() == null) ? 0 : this.getAccSeqNo()
						.hashCode());
		result = prime
				* result
				+ ((this.getAccSubSeqNo() == null) ? 0 : this.getAccSubSeqNo()
						.hashCode());

		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof AccountSystemAddTradDetail))
			return false;

		AccountSystemAddTradDetail other = (AccountSystemAddTradDetail) obj;

		if (!PCPSUtil.compareObject(this.getAccSeqNo(), other.getAccSeqNo()))
			return false;

		return PCPSUtil.compareObject(this.getAccSubSeqNo(), other
				.getAccSubSeqNo());
	}
}
